<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Table::RTable</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Table::RTable</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/rtable_rb.html">
                rtable.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A <a href="RTable.html">Table::RTable</a> Class that creates a spreadsheet
like table api instance variables:
</p>
<pre>
  @rows =&gt; array of hashes (cells) [{:cols=&gt;[]}]
  @formats =&gt; {} stores Spreadseet::Format's for cells
  @alias_format =&gt; {} stores pointers for cells that were created as a push or fill invocation and overflowed the initial cell
  @ansi =&gt; {} stores ansi format code for cells
  @also =&gt; {} stores pointers for cells that were created as a push or fill invocation and overflowed the initial cell
    # note the above hashes have keys like &quot;x:y&quot; where x is a row and y is a column
  @defualt_align_method =&gt; Symbol defualt is :ljust defines how data is aligned in cell given the @cell_len
  @cell_len =&gt; Fixnum defualt is 20 length of strings in cells, strings over @cell_len
   used by smart methods like push and fill to maintain a uniform look across formats
   self.fill_xy does not worry about cell lengths
  @def_space =&gt; String default is &quot; &quot; &lt;- space used by align methods to fill cell remainder
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000055">add</a>&nbsp;&nbsp;
      <a href="#M000036">add_row</a>&nbsp;&nbsp;
      <a href="#M000047">clear_all_formats</a>&nbsp;&nbsp;
      <a href="#M000048">clear_format</a>&nbsp;&nbsp;
      <a href="#M000033">col_length</a>&nbsp;&nbsp;
      <a href="#M000040">color_xy</a>&nbsp;&nbsp;
      <a href="#M000038">fill</a>&nbsp;&nbsp;
      <a href="#M000039">fill_xy</a>&nbsp;&nbsp;
      <a href="#M000052">format</a>&nbsp;&nbsp;
      <a href="#M000031">format_at</a>&nbsp;&nbsp;
      <a href="#M000051">get</a>&nbsp;&nbsp;
      <a href="#M000042">get_xy</a>&nbsp;&nbsp;
      <a href="#M000054">insert_col</a>&nbsp;&nbsp;
      <a href="#M000032">inspect</a>&nbsp;&nbsp;
      <a href="#M000050">is?</a>&nbsp;&nbsp;
      <a href="#M000034">length</a>&nbsp;&nbsp;
      <a href="#M000030">new</a>&nbsp;&nbsp;
      <a href="#M000035">property</a>&nbsp;&nbsp;
      <a href="#M000053">push</a>&nbsp;&nbsp;
      <a href="#M000037">row_col_length</a>&nbsp;&nbsp;
      <a href="#M000043">show</a>&nbsp;&nbsp;
      <a href="#M000046">show_cell</a>&nbsp;&nbsp;
      <a href="#M000044">show_helper</a>&nbsp;&nbsp;
      <a href="#M000045">show_row</a>&nbsp;&nbsp;
      <a href="#M000049">smart_format</a>&nbsp;&nbsp;
      <a href="#M000041">to_excel</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="../Table.html">Table</a></span>
      </div>
    </div>

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">also</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">book</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">cell_len</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">def_space</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">defualt_align_method</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">formats</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">max_cols</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">rows</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">width</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000030" class="method-detail">
        <a name="M000030"></a>

        <div class="method-heading">
          <a href="RTable.src/M000030.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000030.html');return false;">
          <span class="method-name">new</span><span class="method-args">(width=135,cell_len=20,max_cols=16)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
width =&gt; console display row <a href="RTable.html#M000034">length</a> <a
href="../Fixnum.html">Fixnum</a> cell_len =&gt; used for smartly displaying
cross file formats by smart methods, <a href="../Fixnum.html">Fixnum</a>
max_cols =&gt; <a href="../Fixnum.html">Fixnum</a> # no methods implement
this but handy for storage to use elswhere
</p>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000055" class="method-detail">
        <a name="M000055"></a>

        <div class="method-heading">
          <span class="method-name">add</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="RTable.html#M000036">add_row</a>
</p>
        </div>
      </div>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="RTable.src/M000036.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000036.html');return false;">
          <span class="method-name">add_row</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="RTable.html#M000055">add</a> a row
</p>
        </div>
      </div>

      <div id="method-M000047" class="method-detail">
        <a name="M000047"></a>

        <div class="method-heading">
          <a href="RTable.src/M000047.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000047.html');return false;">
          <span class="method-name">clear_all_formats</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
clear all formats for all cells in self
</p>
        </div>
      </div>

      <div id="method-M000048" class="method-detail">
        <a name="M000048"></a>

        <div class="method-heading">
          <a href="RTable.src/M000048.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000048.html');return false;">
          <span class="method-name">clear_format</span><span class="method-args">(x,foo=nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
if foo == nil: clears <a href="RTable.html#M000052">format</a> in row x if
foo is a <a href="../Fixnum.html">Fixnum</a>: clear <a
href="RTable.html#M000052">format</a> at cell x,foo if foo is a Range:
clear <a href="RTable.html#M000052">format</a> of cells in range at row x
</p>
        </div>
      </div>

      <div id="method-M000033" class="method-detail">
        <a name="M000033"></a>

        <div class="method-heading">
          <a href="RTable.src/M000033.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000033.html');return false;">
          <span class="method-name">col_length</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
most columns used, <a href="../Fixnum.html">Fixnum</a>
</p>
        </div>
      </div>

      <div id="method-M000040" class="method-detail">
        <a name="M000040"></a>

        <div class="method-heading">
          <a href="RTable.src/M000040.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000040.html');return false;">
          <span class="method-name">color_xy</span><span class="method-args">(row,col,*opts)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
set the <a href="RTable.html#M000052">format</a> of cell row,col to *opts
if cell was created with a smart method like <a
href="RTable.html#M000038">fill</a> (<a
href="RTable.html#M000053">push</a>) the cells in
self.also[&quot;#{row}:#{col}&quot;]
</p>
<pre>
  will also be formatted (tho use self.smart_format else mileage may very)
</pre>
<p>
*opts =&gt; String,String &#8230; of values fore:[color], back:[color],
bold, italic, underline, strike
</p>
        </div>
      </div>

      <div id="method-M000038" class="method-detail">
        <a name="M000038"></a>

        <div class="method-heading">
          <a href="RTable.src/M000038.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000038.html');return false;">
          <span class="method-name">fill</span><span class="method-args">(str,row,foo=nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="RTable.html#M000053">push</a> alias&#8216;s this append cell to
row: row if foo == <a href="../Fixnum.html">Fixnum</a> then set value of
cell row,foo to str str =&gt; value to set, may be any class as str.to_s is
called smartly splits str if str.lenght &gt; self.cell_len and appends the
required cells returns cell [initial_cell_created,last_created_cell] of the
invocation TODO: return cell value in the array
</p>
        </div>
      </div>

      <div id="method-M000039" class="method-detail">
        <a name="M000039"></a>

        <div class="method-heading">
          <a href="RTable.src/M000039.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000039.html');return false;">
          <span class="method-name">fill_xy</span><span class="method-args">(str,row,col)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
simply set value of cell row,col to str str =&gt; the value to set cell to,
any class as str.to_s is called returns column number, todo: return string
</p>
        </div>
      </div>

      <div id="method-M000052" class="method-detail">
        <a name="M000052"></a>

        <div class="method-heading">
          <span class="method-name">format</span><span class="method-args">(row,col,*opts)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="RTable.html#M000040">color_xy</a>
</p>
        </div>
      </div>

      <div id="method-M000031" class="method-detail">
        <a name="M000031"></a>

        <div class="method-heading">
          <a href="RTable.src/M000031.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000031.html');return false;">
          <span class="method-name">format_at</span><span class="method-args">(x,y)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
returns formatting at row x, column y as english readable values in an
array
</p>
        </div>
      </div>

      <div id="method-M000051" class="method-detail">
        <a name="M000051"></a>

        <div class="method-heading">
          <span class="method-name">get</span><span class="method-args">(row,col)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="RTable.html#M000042">get_xy</a>
</p>
        </div>
      </div>

      <div id="method-M000042" class="method-detail">
        <a name="M000042"></a>

        <div class="method-heading">
          <a href="RTable.src/M000042.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000042.html');return false;">
          <span class="method-name">get_xy</span><span class="method-args">(row,col)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
returns value at cell row,col if row or row:col not used returns error
string: #[&#8216;row&#8217; or &#8216;col&#8217;]: [col or row] -&gt;
TABLE.no[&#8216;Row&#8217; or &#8216;Col&#8217;]Error if error it also does
p(error)
</p>
        </div>
      </div>

      <div id="method-M000054" class="method-detail">
        <a name="M000054"></a>

        <div class="method-heading">
          <span class="method-name">insert_col</span><span class="method-args">(str,row,foo=nil)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="RTable.html#M000038">fill</a>
</p>
        </div>
      </div>

      <div id="method-M000032" class="method-detail">
        <a name="M000032"></a>

        <div class="method-heading">
          <a href="RTable.src/M000032.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000032.html');return false;">
          <span class="method-name">inspect</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000050" class="method-detail">
        <a name="M000050"></a>

        <div class="method-heading">
          <a href="RTable.src/M000050.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000050.html');return false;">
          <span class="method-name">is?</span><span class="method-args">(x,y,sym)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000034" class="method-detail">
        <a name="M000034"></a>

        <div class="method-heading">
          <a href="RTable.src/M000034.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000034.html');return false;">
          <span class="method-name">length</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Array [rows,most_columns_used]
</p>
        </div>
      </div>

      <div id="method-M000035" class="method-detail">
        <a name="M000035"></a>

        <div class="method-heading">
          <a href="RTable.src/M000035.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000035.html');return false;">
          <span class="method-name">property</span><span class="method-args">(x,y)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Array of [Spreadsheet::Format,ansi_format_string] for row x, column y
</p>
        </div>
      </div>

      <div id="method-M000053" class="method-detail">
        <a name="M000053"></a>

        <div class="method-heading">
          <span class="method-name">push</span><span class="method-args">(str,row,foo=nil)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="RTable.html#M000038">fill</a>
</p>
        </div>
      </div>

      <div id="method-M000037" class="method-detail">
        <a name="M000037"></a>

        <div class="method-heading">
          <a href="RTable.src/M000037.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000037.html');return false;">
          <span class="method-name">row_col_length</span><span class="method-args">(x)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
amount of cells in row: x
</p>
        </div>
      </div>

      <div id="method-M000043" class="method-detail">
        <a name="M000043"></a>

        <div class="method-heading">
          <a href="RTable.src/M000043.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000043.html');return false;">
          <span class="method-name">show</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
display the table in the console formatting will display
</p>
        </div>
      </div>

      <div id="method-M000046" class="method-detail">
        <a name="M000046"></a>

        <div class="method-heading">
          <a href="RTable.src/M000046.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000046.html');return false;">
          <span class="method-name">show_cell</span><span class="method-args">(x,y,also=true,nonewline=false)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
displays the cell at row x,column y if also == true will display the cells
generated by a smart <a href="RTable.html#M000038">fill</a> or <a
href="RTable.html#M000053">push</a> also if nonewline == true will not
print &quot;\n&quot;
</p>
        </div>
      </div>

      <div id="method-M000044" class="method-detail">
        <a name="M000044"></a>

        <div class="method-heading">
          <a href="RTable.src/M000044.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000044.html');return false;">
          <span class="method-name">show_helper</span><span class="method-args">(x,y)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
gets the string and ansi <a href="RTable.html#M000052">format</a> code at
cell x,y returns [code_str,string]
</p>
        </div>
      </div>

      <div id="method-M000045" class="method-detail">
        <a name="M000045"></a>

        <div class="method-heading">
          <a href="RTable.src/M000045.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000045.html');return false;">
          <span class="method-name">show_row</span><span class="method-args">(row,range=:full)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
display a row row =&gt; <a href="../Fixnum.html">Fixnum</a> range =&gt;
defualts to :full. if Range dispaly cells in range of row: row
</p>
        </div>
      </div>

      <div id="method-M000049" class="method-detail">
        <a name="M000049"></a>

        <div class="method-heading">
          <a href="RTable.src/M000049.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000049.html');return false;">
          <span class="method-name">smart_format</span><span class="method-args">(x,foo,*opts)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
if foo is a <a href="../Fixnum.html">Fixnum</a>: <a
href="RTable.html#M000052">format</a> cell: x,foo to *opts if <a
href="RTable.html#M000052">format</a> is a Range: <a
href="RTable.html#M000052">format</a> cells in foo at row x to *opts if foo
is anything else: set the <a href="RTable.html#M000052">format</a> of row x
to *opts if cell was created with a smart method like <a
href="RTable.html#M000038">fill</a> (<a
href="RTable.html#M000053">push</a>) the cells in
self.also[&quot;#{row}:#{col}&quot;]
</p>
<pre>
  will also be formatted
</pre>
<p>
*opts =&gt; String,String &#8230; of values fore:[color], back:[color],
bold, italic, underline, strike
</p>
        </div>
      </div>

      <div id="method-M000041" class="method-detail">
        <a name="M000041"></a>

        <div class="method-heading">
          <a href="RTable.src/M000041.html" target="Code" class="method-signature"
            onclick="popupCode('RTable.src/M000041.html');return false;">
          <span class="method-name">to_excel</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
create an excel work book of self named name in module Spreadsheet
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>